package com.dgw.springbootexvalid.controller;

import com.dgw.springbootexvalid.bean.Dog;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: springboot-exception-valid
 * @description:
 * @author: Mr.Dai
 * @create: 2020-04-01 22:14
 **/
@RestController
public class DogController {


    @GetMapping(value = "/json",produces = MediaType.APPLICATION_JSON_VALUE)
    public Dog json(){
        Dog dog = new Dog();
        dog.setId(1);
        dog.setName("tomcat");
        dog.setAge(5);
        dog.setType("tu gou");
        return dog;
    }
    @GetMapping(value = "xml",produces = MediaType.APPLICATION_XML_VALUE)
    public Dog xml(){
        Dog dog = new Dog();
        dog.setId(1);
        dog.setName("tomcat");
        dog.setAge(5);
        dog.setType("tu gou");
        return dog;
    }
}
